package com.olocat.cjx.nsims.controller

import com.olocat.cjx.nsims.service.NoticeService
import com.olocat.cjx.nsims.util.Response
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.RestController
import javax.annotation.Resource

@RestController
class NoticeController {
    @Resource
    lateinit var noticeService: NoticeService

    @GetMapping("api/notice/get")
    fun getNotices(id:String) : Response {
        return Response.builder(noticeService.getNoticeByUserId(id))
    }

    @GetMapping("api/notice/count")
    fun getCount(id: String): Response {
        return Response.builder(noticeService.countNotices(id))
    }

    @GetMapping("api/notice/read")
    fun readAll(id: String): Response {
        noticeService.readAll(id)
        return Response.builder()
    }
}